package com.niit.project.controller;

import com.niit.project.entity.Goods;
import com.niit.project.service.GoodsService;
import com.niit.project.service.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet(name = "ShowUserGoodsInforeport", value = "/ShowUserGoodsInforeport")
public class ShowUserGoodsInforeport extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Integer id = Integer.valueOf(request.getParameter("id"));
        GoodsService goodsService = new GoodsServiceImpl();
        Goods goods = goodsService.selectGoodsById(id);
        request.setAttribute("goods",goods);
        request.getRequestDispatcher("/report.jsp").forward(request,response);
    }
}
